import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import 'normalize.css/normalize.css';
import '@/assets/iconfont.css';
import animated from 'animate.css';
import hljs from 'highlight.js'
import 'highlight.js/scss/tomorrow-night-eighties.scss'
import '@/assets/transition.scss'

Vue.directive('highlight', function (el) {
  let blocks = el.querySelectorAll('pre code');
  blocks.forEach((block) => {
    hljs.highlightBlock(block)
  })
})
import VueLazyLoad from 'vue-lazyload';
Vue.use(VueLazyLoad, {
  error: require('@/assets/image/error.png'),
  loading: require('@/assets/image/loading.gif')
})
Vue.use(animated)
NProgress.configure({ showSpinner: false });
Vue.config.productionTip = false
router.beforeEach((to, from, next) => {
  NProgress.start();
  next();
})
router.afterEach(() => {
  // finish progress bar
  NProgress.done()
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
